package com.xiaoa.gossip.cluster.action;

import com.xiaoa.gossip.cluster.command.CurrentNodeState;
import com.xiaoa.gossip.cluster.command.NodeState;
import com.xiaoa.gossip.cluster.service.MetadataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author luokaichuang
 * @time 2020/6/19
 */
@RestController
@RequestMapping("data")
public class DataAction {

    @Autowired
    private MetadataService metadataService;

    @Autowired
    private CurrentNodeState currentNodeState;

    @GetMapping("updateTestInfo")
    public NodeState updateTestInfo(String value) {
        metadataService.doAddMetadata("test", value);
        return currentNodeState;
    }

}
